begincreaturescript;

variables;

short i,target,choice,whattosay;

body;

beginstate INIT_STATE;
break;

beginstate DEAD_STATE;
	reset_dialog();
	add_dialog_str(0,"With a final cackle, Snootfairy falls to the ground and dies.  At his death, the Altar begins to rumble and shake uncontrollably.  OH NO, IT'S OVERHEATING!  It will explode if you don't do something cool like push it into the pit.",0);
	add_dialog_str(1,"Push this suckah off the platform?",0);
	add_dialog_choice(0,"Actually I think I see an 'on/off' switch...");
	add_dialog_choice(1,"Hell yeah!");
	choice = run_dialog(1);

	if(choice == 2){
		message_dialog("You shove the altar forward with all your might.  It careens down the pit for a long time before exploding in a massive fiery ball of flame.  The world is now a safer place.","");
		set_terrain(24,23,0);
		inc_flag(10,10,1);
		}
		else{
			message_dialog("You flip the switch and the altar immediately stops.  There's no careening and no awesome, massive, fiery explosion.  How boring.","");
			}
	message_dialog("Upon Snootfairy's death, you notice he dropped a note.  You pick it up.","");
	reward_give(447);
	set_flag(2,20,0);
break;

beginstate START_STATE; 
	// if I have a target for some reason, go attack it
	if (target_ok()) {
		if (dist_to_char(get_target()) <= 16)
			set_state(3);
			else set_target(ME,-1);
		}
	
	// Look for a target, attack it if visible
	if (select_target(ME,8,0)) {
		do_attack();
		set_state(3);
		}
		
	// Have I been hit? Strike back!
	if (who_hit_me() >= 0) {
		set_target(ME,who_hit_me());
		do_attack();
		set_state(3);
		}

	// if we're in combat and the above didn't give me anything to do, just
	// stop now. Otherwise, game will keep running script, and that eats up CPU time.
	if (am_i_doing_action() == FALSE)
		end_combat_turn();

	whattosay = get_ran(1,0,4);

	if (whattosay == 0)
		text_bubble_on_char(ME,"KEKEKEKEKEKE!");
break;

beginstate 3; // attacking
	if (target_ok() == FALSE)
		set_state(START_STATE);

	whattosay = get_ran(1,0,4);

	if (whattosay == 0)
		text_bubble_on_char(ME,"KEKEKEKEKEKE!");

	do_attack();
break;


beginstate TALKING_STATE;
	print_str("Talking: Snootfairy doesn't respond.");
break;